﻿@{
    string nameDisplayPlugin = typeof(Plugin_Interfaces.DisplayList).FullName;
}
<!DOCTYPE html>www.codeplex.com
<html>
<head>
    <meta charset="utf-8" />
    @*required by chosen*@
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/chosen.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/chosen.jquery.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/PMKB.js")" type="text/javascript"></script>
    <script src="@Links.Scripts.tiny_mce.tiny_mce_js" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/zeroclipboard.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/knockout-2.1.0.js")" type="text/javascript"></script>
    <script type="text/javascript">

        $(function () {
          
                       if (!$.browser.msie) {
            ZeroClipboard.setMoviePath('@Url.Content("~/Content/swf/ZeroClipboard.swf")');
            $('a:contains("Clipboard")').each(function () {
                var $id = $(this).attr("id");
                var $text = $(this).prevAll("a").text();
                CopyClipBoardNotIe($text, $id);
            });
            }

        });
    </script>
</head>
<body>
    <div class="page">
        <header>
            <div id="title">
                <h1>PM Knowledge Base</h1>
            </div>
            <div id="logindisplay">
                @Html.Partial("_LogOnPartial")
            </div>
            <nav>
                <ul id="menu">
                    <li>@Html.ActionLink("Home", MVC.Home.Index())</li>
                    <li>@Html.ActionLink(PMKB_DAL.PMKBEntities_resource.Link_List, MVC.Link.Index())</li>
                    <li>@Html.ActionLink(PMKB_DAL.PMKBEntities_resource.Tag_List, MVC.Tag.List())</li>
                    <li>@Html.ActionLink(PMKB_DAL.PMKBEntities_resource.User_List, MVC.User.Index())</li>
                    
                    <li>@Html.ActionLink("Plugins", MVC.plugin.All.Index())</li>
                    @foreach (var item in PMKB_Web.SiteUtils.plugins)
                    {
                        var p=item.Value.GetInterface(nameDisplayPlugin);
                        if(p != null)
                        {
                            var plugin = PMKB_Web.pluginsCode.PluginControllerFactory.pluginFromName(item.Key,"") ;
                            var name = plugin as Plugin_Interfaces.MVCPLugin ;
                            <text><li>@Html.ActionLink(name.Name, MVC.plugin.All.GotoPlugin(item.Key))</li></text>
                        }
                    }
                    <li>@Html.ActionLink("About", MVC.Home.About())</li>
                </ul>
            </nav>
        </header>
        <section id="main">
            @RenderBody()
        </section>
        <footer>
        </footer>
    </div>
      
  <script type="text/javascript">
      function CopyClipBoardNotIe(text, id) {
        
          var clip = new ZeroClipboard.Client();

          clip.glue(id);
          clip.setText(text);
//          clip.addEventListener('onMouseOver', function () {
//       
//              clip.setText(text);
//          });
//          
        
        
        
      }
      function copyClipboard(text,id) {

          if (window.clipboardData) // IE
          {
              window.clipboardData.setData("Text", text);
          }
//           if (!$.browser.msie) {
//             
//              CopyClipBoardNotIe(text, id);
//            
//          }
         
      }


      $(document).ready(function () {

          $(".chzn-select").chosen({ no_results_text: "No results matched" });

          $.ajaxSetup({
              cache: false,
              error: function (x, e) {
                  if (x.status == 0) {
                      alert('You are offline!!\n Please Check Your Network.');
                  } else if (x.status == 404) {
                      alert('Requested URL not found.');
                  } else if (x.status == 500) {
                      alert('Internal Server Error.' + x.responseText);
                  } else if (e == 'parsererror') {
                      alert('Error.\nParsing JSON Request failed.');
                  } else if (e == 'timeout') {
                      alert('Request Time out.');
                  } else {
                      alert('Unknown Error.\n' + x.responseText);
                  }
              }
          });
      });


        function AddNewTag(cmbTags) {
            var newTag = window.prompt("New tag name","");
            if (!newTag)
                return;
            $.ajax({
                type: "POST",
                url: '@Url.Action(MVC.Tag.AddNewTag())',
                data: { id: newTag },
                datatype: "JSON",
                success: function (returndata) {
                    if (returndata.ok) {
                        $("#" + cmbTags).append($("<option></option>")
                            .attr("value", returndata.data.TagID)
                            .text(returndata.data.TagName)
                            .attr('selected', 'selected'));
                        $("#" + cmbTags).trigger("liszt:updated");
                        window.alert("added tag:" + returndata.data.TagName);
                    }
                    else {
                        //this is an error from the server
                        window.alert(' error : ' + returndata.message);
                    }
                }
            });
        }

        tinyMCE.init({
            // General options
            mode: "textareas",
            //theme: "advanced",
            theme: "simple",
            //plugins: "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

            // Theme options
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            theme_advanced_resizing: true,

            // Example content CSS (should be your site CSS)
            content_css: "css/content.css",

            // Drop lists for link/image/media/template dialogs
            template_external_list_url: "lists/template_list.js",
            external_link_list_url: "lists/link_list.js",
            external_image_list_url: "lists/image_list.js",
            media_external_list_url: "lists/media_list.js",

            // Style formats
            style_formats: [
            { title: 'Bold text', inline: 'b' },
            { title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
            { title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
            { title: 'Example 1', inline: 'span', classes: 'example1' },
            { title: 'Example 2', inline: 'span', classes: 'example2' },
            { title: 'Table styles' },
            { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
        ]
        

           
            // Replace values for the template plugin
//            ,template_replace_values: {
//                username: "Some User",
//                staffid: "991234"
//            }
        });
        </script>
</body>
</html>
